<%@page import="aex.domain.ArticleCategory"%>
<%@page import="aex.domain.Article"%>
<%@page import="aex.service.ShowViewService"%>
<%@page import="aex.util.SSHUtil"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	WebApplicationContext ac = SSHUtil.getApplication(request);
	ShowViewService svService = (ShowViewService) ac.getBean(ShowViewService.SERVICE_NAME);
%>
<style type="text/css">
	h1,h2,h3{
		margin-top: 0px;
	}
</style>
<div class="container_right">
        <!--全站搜索--> 
        <div id="search_box">
            <form action="visitor/visitor_serch.do?serchType=1" method="post">
              <h2>全站搜索</h2>
             <div>
             
	  		<input name='keyWord' class='input-text search_con' placeholder='主题|用户|药品|疗法'>
	  		<input type="submit"  value="搜索" class='search_btn'>
  	
             </div>
             
            </form>
        </div>
        <!--最新话题-->
        <div id="topic_box">
            <h2>最新话题</h2>
            
            <%
            	List<Article> newArts=svService.getNewArticle(5);
            	for(Article art:newArts){
            		out.print(
            				"<div class='topic'>"+
            	              "<div class='topic_content'><a href='visitor/visitor_article.do?arId="+art.getArId()+"'>"+art.getArTitle()+"</a></div>"+
            	              "<div class='topic_time'><img src='images/aex_userImg/time_jiao.png' align='left'>"+art.getArTime().toLocaleString()+"</div>"+
            	             " <div class='topic_group'>"+art.getArticleCategory().getAcName()+"</div>"+
            	          	"</div>");
            	}
            	
            %>
            
            
           
        </div>
        <!--名医访谈-->
        <div id="doctor_talk">
           <h2>名医访谈</h2>
           <ul>
           	<%
           		List<Article> docters=svService.getShowBoxArticle("名医访谈", 4);
           		for(Article art:docters){
           			out.print("<li><a href='visitor/visitor_article.do?arId="+art.getArId()+"'>"+art.getArTitle()+"</a></li>");		
           		}
           	%>
             
           </ul>
        </div>
        <!--社区热帖-->
        <div id="thread">
           <h2>社区热帖</h2>
           <%
           	List<Article> hotArts=svService.getHotArticle(4);
           for(Article art:hotArts){
        	   out.print(
        			   "<div class='thread_title'><a href='visitor/visitor_article.do?arId="+art.getArId()+"'>"+art.getArTitle()+"</a></div>"+
        	           "<div class='thread_comment'><span>浏览量 ("+art.getArViewCount()+")</span></div>");
           }
           
           %>
           
           
           
        </div>
        <!--疾病榜-->
        <div id="diseases_list">
          <h2>疾病榜</h2>
          <div class="small_title"><span>排名</span><span>疾病</span><span id="diseases_hot">热度</span></div>
         
         <%
         	List<ArticleCategory> topCategotys=svService.getTopCategory(5);
         	int index=1;
         	for(ArticleCategory category:topCategotys){
         		out.print(
         				"<div class='diseases'>"+
            				"<span class='ranking'>"+index+"</span>"+
            				"<div class='diseases_name'><a href='visitor/visitor_showCategory.do?id="+category.getAcId()+"'>"+category.getAcName()+"</a></div>"+
            				"<div class='diseases_count'>"+category.getAcUserNum()+"</div>"+
          				"</div>");
         		index++;
         	}
         %>
        </div>
     </div>
